package com.wangxc.rabbitmq.producter;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class MessageSender {
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send(String message) {
        String sendMsg = "hello1 " + new Date() + "   " + message;
        System.out.println("Sender1 : " + sendMsg);
        this.amqpTemplate.convertAndSend("hello", sendMsg);
    }
}
